package core.development.jetty;

import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;  
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.webapp.WebAppContext;  

import core.tool.common.SystemInfo;
import core.tool.log.log4j.EasyLogger;
  
public class DeployProjectToJetty {  
    public static void main(String[] args) throws Exception {  
    	
    	EasyLogger.init(SystemInfo.ROOT_PATH);	
        try {
			int port = 8020;
			Server server = new Server();
			Connector connector = new SelectChannelConnector();
			connector.setPort(port);
			server.addConnector(connector);
			System.out.println(System.getProperty("user.dir")+ "/WebRoot");
			WebAppContext webapp = new WebAppContext(System.getProperty("user.dir")+ "/WebRoot", "/JavaHi");
			server.setHandler(webapp);
			server.start();
		} catch (Exception e) {
			e.printStackTrace();
		}    	
    }  
}  
